package cn.quang.search.admin.enums;

import java.util.Arrays;

public enum EntityDataSourceTypeEnum {
    ES(1, "ES数据源"),
    MYSQL(2, "MySQL数据源"),
    ;

    private final int code;
    private final String name;

    EntityDataSourceTypeEnum(int code, String name) {
        this.code = code;
        this.name = name;
    }

    public int getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

    public static EntityDataSourceTypeEnum of(int code){
        return Arrays.stream(values()).filter(input -> input.getCode() == code).findAny().orElse(null);
    }
}
